package pkg.chemdrm;

import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.opengl.texture.region.TextureRegion;

public class FogEntity extends Sprite implements Entity {
	float mAngleVelocity = (float)Math.random()*10f;
	
	AIRegion mRegion;
	public FogEntity(AIRegion pRegion, float pX, float pY, float pWidth, float pHeight, TextureRegion pTextureRegion) {
		super(pX, pY, pWidth, pHeight, pTextureRegion);
		
		
		mRegion = pRegion;
		
	
		
	}

	public void update(float dt) {
		this.mRotation += mAngleVelocity*dt;
		mX += (float)(Math.random()*5f*dt);
		if(mX >= mRegion.getX() + mRegion.getWidth())
		{
			mX = mRegion.getX();
		}
		else if(mX <= mRegion.getX())
		{
			mX = mRegion.getX() + mRegion.getWidth();
		}
		
		mY += (float)(Math.random()*5f*dt);
		if(mY >= mRegion.getY() + mRegion.getHeight())
		{
			mY = mRegion.getY();
		}
		else if(mY <= mRegion.getY())
		{
			mY = mY + mRegion.getY() + mRegion.getHeight();
		}
	}

	public boolean getExists() 
	{
		
		return true;
	}

}
